﻿using System;
using System.Web.Mvc;
using Sharp.Infrastructure.Communication;
using Sharp.Platform.Mvc;
using Sharp.ServiceContracts.CMS;

namespace Sharp.WebBooter.Areas.CMS.Controllers
{
    public class CommentController : Controller
    {
        // GET: Comment
        public ActionResult Index()
        {
            return View();
        }
        /// <summary>
        /// 分页数据
        /// </summary>
        /// <param name="param"></param>
        /// <returns></returns>
        [HttpPost]
        public ActionResult GetPaged(DataTableParameter param)
        {
            using (var proxy = new ServiceProxy<IMemberService>())
            {
                //var page = proxy.Channel.GetTagPaged(param.ToPagingFeature());
                //var page = new PagedResult<CommentDTO>();
                //page.Data.Add(new CommentDTO()
                //{
                //    IsAnonymous = true,
                //    IP = "210.79.76.72",
                //    Content = "内容内容内容内容内容内容"
                //});
                var page = proxy.Channel.GetCommentPaged(param.ToPagingFeature());
                return this.Store(page);
            }
        }
        [HttpPost]
        [Permission(Name = "删除", Order = 3)]
        public ActionResult Delete(Guid[] ids)
        {
            using (var proxy = new ServiceProxy<IMemberService>())
            {
                var res = proxy.Channel.DeleteComments(ids);
                return this.JsonNet(res);
            }
        }
    }
}